/*************************************************************************
	> File Name: task.hpp
	> Author: H.M. Lau
	> Mail: hm.lau@outlook.com
	> Created Time: 2023/09/29 23:15
 ************************************************************************/

#pragma once

#include "comm.hpp"
#include "log.hpp"
#include "thread.hpp"

typedef int(*func_t)(int, int);
class Task
{
public:
    Task ()
    {}

    Task(int x, int y, func_t func):_x(x), _y(y), _func(func)
    {}

    void operator ()(const std::string &name)
    {
        logMessage(WARNING, "%s finished:%d+%d=%d | %s | %d", name.c_str(), _x, _y, _func(_x, _y), __FILE__, __LINE__);
    }

private:
    int _x;
    int _y;
    func_t _func;
};
